package org.ccay.message.dao;

import java.util.Date;
import java.util.List;

import org.apache.ibatis.annotations.Param;

import org.ccay.core.base.PageVO;
import org.ccay.core.base.PagedResult;
import org.ccay.message.PushMessageVO;

/**
 * 
 * 消息推送接口
 * @author chaowangbang
 * @since 2012-11-5
 */
public interface IPushMessageDao {

	/**
	 * 根据条件查询消息
	 * 
	 * @param messageVO
	 * @param pageVO
	 * @return
	 * @throws ApplicationException Created：2012-10-19
	 * @author chaowangbang
	 */
	public PagedResult<PushMessageVO> usePagedMessageList(PushMessageVO messageVO, PageVO pageVO);
			

	/**
	 * 创建消息
	 * 
	 * @param pushMessageVO
	 * @return Created：2012-10-19
	 * @author chaowangbang
	 */
	public int createMessage(PushMessageVO messageVO);

	/**
	 * 更具条件查询消息 不带分页
	 * 
	 * @param messageVO
	 * @return Created：2012-10-19
	 * @author chaowangbang
	 */
	public List<PushMessageVO> useMessageList(PushMessageVO messageVO);

	/**
	 * 删除消息
	 * 
	 * @param messageVO
	 * @return
	 * @throws ApplicationException Created：2012-10-19
	 * @author chaowangbang
	 */
	public int deleteMessage(PushMessageVO messageVO);

	/**
	 * 更新消息
	 * 
	 * @param pushMessageVO Created：2012-10-19
	 * @author chaowangbang
	 */
	public int updateMessage(PushMessageVO messageVO);
	
	/**
	 * 
	 * @author chaowangbang
	 * @since 2012-11-9
	 * @param messageVOs
	 */
	public void updateMessageList(List<PushMessageVO> messageVOs);
	
	/**
	 * 
	 * @author chaowangbang
	 * @since 2012-11-9
	 * @param messageList
	 * @param messageVO
	 */
	public void updateMessageListStatus(List<PushMessageVO> messageList,PushMessageVO messageVO);
	
	/**
	 * 
	 * @author chaowangbang
	 * @since 2012-11-9
	 * @param messageList
	 * @param messageVO
	 */
	public void updateMessageStatus(PushMessageVO messageVO);
	
	/**
	 * 
	 * @author chaowangbang
	 * @since 2012-12-24
	 * @return
	 */
	public List<PushMessageVO> findUselessMessageList();
	
	
	/**
	 * 删除消息
	 * 
	 * @param messageVO
	 * @return
	 * @throws ApplicationException Created：2012-10-19
	 * @author chaowangbang
	 */
	public int deleteUserMessage(PushMessageVO messageVO);
	
	
	/**
	 * 删除消息
	 * 
	 * @param messageVO
	 * @return
	 * @throws ApplicationException Created：2012-10-19
	 * @author chaowangbang
	 */
	public int deleteUselessMessage(@Param("hasReadMessageCleanDuration") Date hasReadMessageCleanDuration,@Param("notReadMessageCleanDuration") Date notReadMessageCleanDuration,@Param("appName") String appName);

	/**
	 * 查询未读的消息个数
	 * @param messageVO
	 * @param includeOverdue 是否包含过期
	 * @return
	 * @author chaowangbang
	 */
	public int findNewMessageCount(@Param("pushMessage") PushMessageVO messageVO,@Param("includeOverdue") boolean includeOverdue);
}
